/**
 * AbstractLetter.java | Created on 30 08 2010
 */
package com.pacm.letter;

import java.util.Arrays;

/**
 * The letter base class
 *
 * @author Paul Augustine C. Mendoza
 */
public abstract class AbstractLetter implements Letter {

    private static final String SPACE = " ";
    private static final String CHARACTER = "*";

    private String[][] matrix;

    protected AbstractLetter(int size) {
        this.matrix = new String[size][size];
    }

    public String[][] getMatrix() {
        return Arrays.copyOf(this.matrix, this.matrix.length);
    }

    protected void setCharacterMark(int rowIndex, int colIndex) {
        this.matrix[rowIndex][colIndex] = CHARACTER;
    }

    protected void setSpaceMark(int rowIndex, int colIndex) {
        this.matrix[rowIndex][colIndex] = SPACE;
    }

    protected int getMiddlePoint() {
        return getMatrix().length / 2;
    }

    protected int getMaxIndex() {
        return getMatrix().length - 1;
    }
}
